From: Claudio Cambra Date: Thu, 28 Nov 2024 16:55:35 +0000 (+0800) Subject: Close isExecutable command outpipe file handle after use X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~30^2^2~197^2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=582beeec6c6ff40637f511b89addc915bf669cf0;p=nextcloud-desktop.git Close isExecutable command outpipe file handle after use Prevents exhaustion of fds Signed-off-by: Claudio Cambra --- diff --git a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift index b511f0a44..f262ff39d 100644 --- a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift +++ b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift @@ -45,7 +45,9 @@ func isExecutable(_ path: String) throws -> Bool { throw CodeSigningError.failedToCodeSign("Failed to determine if \(path) is an executable.") } - let outputData = outPipe.fileHandleForReading.readDataToEndOfFile() + let outputFileHandle = outPipe.fileHandleForReading + let outputData = outputFileHandle.readDataToEndOfFile() + try outputFileHandle.close() let output = String(data: outputData, encoding: .utf8) ?? "" return output.contains("Mach-O 64-bit executable") }